﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SachOnlineLibrary.Public;
using System.Data.SqlClient;
using SachOnlineLibrary.DAL;
using System.Data;

namespace SachOnlineLibrary.DAL
{
    public class GioHangDAL
    {
        KetNoiDB ketnoi = new KetNoiDB();
        private ChiTietDatHang _giohang = new ChiTietDatHang();

        public ChiTietDatHang Giohang
        {
            get { return _giohang; }
            set { _giohang = value; }
        }

        public bool Them_GioHang()
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "insert into chitietphieudathang values(@masach,@maphieu,@soluong,@dongia)";
            cmd.Parameters.Add("@Masach", SqlDbType.Int).Value = Giohang.MaSach;
            cmd.Parameters.Add("@Maphieu", SqlDbType.Int).Value = Giohang.MaPhieu;
            cmd.Parameters.Add("@SoLuong", SqlDbType.Int).Value = Giohang.SoLuong;
            cmd.Parameters.Add("@DonGia", SqlDbType.Int).Value = Giohang.DonGia;
            return ketnoi.ExecuteNonQuery(cmd);
        }
    }
}
